export function NF(nums: number[], max: number): number[][] {
  const open: { cap: number; index: number[] }[] = [];

  while (nums.length) {
    const b = { cap: 0, index: new Array() };

    nums.forEach((v, i) => {
      if (b.cap + v <= max) {
        b.cap += v;
        b.index.push(v);
        nums.splice(i, 1);
      }
    });

    open.push(b);
  }

  nums.forEach((v) => {});

  return open.map((v) => v.index);
}
